package com.jiangli.mapper;

import com.jiangli.entity.UserFavorite;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserFavoriteMapper {
    @Select("select * from user_favorite where  user_id=#{id}")
    List<UserFavorite> getUserFlavorListByid(Long id);


    void deleteByUidAndDishId(Long userId, List<Long> dishIds);

    @Select("select count(dish_id) from user_favorite where user_id=#{userId}")
    int selectUserFavoriteCount(Long userId);

    void insert(UserFavorite userFavorite);

    @Delete("delete from user_favorite where dish_id=#{dishId}")
    void deleteByDishId(Long dishId);
}
